package com.lyh.utils;

import org.springframework.ui.Model;

public class HtmlCode {
    public static final String HOST = "http://47.103.125.53";
    public static final String LOCALHOST = "http://localhost";

    public static String getHost(){
        return LOCALHOST;
    }
    public static String getLocalhost(){
        return LOCALHOST;
    }
    /**
     * 激活邮件的html代码
     */
    public static String getHtml(String username,String active){
        String html = "<br>\n" +
                "        <div class=\"row\">\n" +
                "            <div class=\"darkBlue\" >\n" +
                "                <style>\n" +
                "                    .lightBlue{\n" +
                "                        background-color: #FAFDFF;\n" +
                "                        border: 1px solid #A6BFDE;\n" +
                "                    }\n" +
                "                    .darkBlue{\n" +
                "                        background-color: #cbe5f7;\n" +
                "                        border: 1px solid #A6BFDE;\n" +
                "                    }\n" +
                "                </style>\n" +
                "                <center>\n" +
                "                    <div style=\"font-size: 30px;padding-top: 20px;padding-bottom: 20px;\">\n" +
                "                        欢迎用户: <span style=\"color: orange;\">"+username+"</span> , 加入12354山卡拉火车网 \n" +
                "                    </div>\n" +
                "                </center>\n" +
                "            </div>\n" +
                "        </div>\n" +
                "        <br/>\n" +
                "        <div class=\"row\">\n" +
                "            <div class=\"lightBlue col-md-8 col-md-push-2\" style=\"height: 200px;\">\n" +
                "                <center style=\"padding-top: 60px;\">\n" +
                "                    <h3>\n" +
                "                        <a id=\"a_button\" style=\"text-decoration: none;color: rgb(0, 140, 255);font-size: 30px;\" \n" +
                "                            href=\""+getHost()+"/user/active/"+username+"/"+active+"\">\n" +
                "                            请 点 击 此 处 激 活 您 的 账 号\n" +
                "                        </a>\n" +
                "                    </h3>\n" +
                "                </center>\n" +
                "            </div>\n" +
                "        </div>" ;
        return html;
    }

    /**
     * 设置model消息的方法
     */
    public static void setMsg(Model model, String msg, int status, String url){
        model.addAttribute("msg",msg);
        model.addAttribute("status",status);
        if("index".equalsIgnoreCase(url))
            model.addAttribute("url",getHost()+"/index");
        else if("refund".equalsIgnoreCase(url))
            model.addAttribute("url",getHost()+"/detail/page/3");
        else
            model.addAttribute("url",url);
    }
}
